#ifndef VECTOR2D_H
#define VECTOR2D_H

#include <valarray>

class Vector2d
{
public:
    Vector2d();
    Vector2d(float,float);
    float x() const;
    void  x(float);
    float y() const;
    void  y(float);

    const Vector2d&  operator +  (const Vector2d&) const;
    const Vector2d&  operator -  (const Vector2d&) const;
    const Vector2d&  operator *  (float) const;
    const Vector2d&  operator /  (float) const;

    Vector2d&        operator =  (float mas[2]);
    Vector2d&        operator += (const Vector2d&);

    /// единичный вектор, сонаправленный с текущим
    const Vector2d&  normal() const;

    /// длина вектора
    float abs() const;

private:
    float vec[2];
};

#endif // VECTOR2D_H
